package com.oauth.filter;

import com.oauth.entity.OAuth2Token;
import lombok.Getter;
import lombok.Setter;
import org.apache.shiro.authc.AuthenticationToken;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

@Setter
@Getter
public class OAuth2AuthenticationFilter {

    private String authCodeParam = "code";

    private String clientId ;

    private String redirectUrl ;

    private String responseType = "code";

    private String failureUrl;


    protected AuthenticationToken createToken(ServletRequest request, ServletResponse response){
        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
        String code = httpServletRequest.getParameter(authCodeParam);
        return new OAuth2Token(code);
    }

}
